/**
 * Created by wangshuyi on 2016/12/27.
 */

'use strict';

/**
 * 公众号
 */

const uuid = require('uuid');
const mongoose = require('../util/mongoDB'),
    Schema = mongoose.Schema;
const config = require('../../config/config');
const tool = require('../util/tool');

const schema = new Schema({
    _id: {type: String, default: uuid.v4},
    openid: {type: String},                      //openid
    name: {type: String, default: "default"},    //会员名称 / 昵称
    remark_name: {type: String},                 //备注名
    icon_url: {type: String},                    //头像
    sex: {type: String},                            //性别
    city: {type: String},                        //所在城市
    language: {type: String},                       //语言
    focusTime: {type: Date, default: Date.now},     //关注时间
    UnionID: {type: String},                        //UnionID
    tags: [{type: String, ref: "Tag"}],             //标签
    officialAccount: {type: String, ref: "OfficialAccount"}, //所属公众号
    user: {type: String, ref: "User"},             //关联账号
    firstParam: {type: String},                     //首次参数
    lastParam: {type: String},                      //最后一次参数
    state: {type: Number, default: 1},           //是否有效
    createTime: {type: Date, default: Date.now},    //创建时间
    creater: {type: String, ref: "User", default: config.dbUser.robot._id},          //创建者
    updateTime: {type: Date, default: Date.now},  //最后更新时间
    updater: {type: String, ref: "User", default: config.dbUser.robot._id},        //最后更新者
    dn: {type: String},
    param1: {type: String},                       //扩展字段1
    param2: {type: String},                         //扩展字段2
    param3: {type: String},                         //扩展字段3
    param4: {type: String},                       //扩展字段4
    param5: {type: String}                        //扩展字段5
});

const model = mongoose.model('DrawPrice', schema);


module.exports = model;
